<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HR医院 - 部门列表</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" th:href="@{favicon.ico}">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/font-awesome.css}" rel="stylesheet">

    <!-- Data Tables -->
    <link th:href="@{/css/plugins/dataTables/dataTables.bootstrap.css}"
          rel="stylesheet">
    <link th:href="@{/css/animate.css}" rel="stylesheet">
    <link th:href="@{/css/style.css}" rel="stylesheet">

</head>
<body class="gray-bg">

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>活动列表</h5>
                </div>
                <div class="ibox-content">
                    <div>

                        <a href="/activity/insertOneActivity" class="btn btn-success">添加活动</a>

                        <form method="get" th:action="@{/activity/selectAllActivities}"  id="searchform">
                            <div class="col-sm-2">
                                <input style="width:100%"  type="text" placeholder="发起人" class="form-control" name="activityAuthor" th:value="${activityAuthor}"/>
                            </div>
                            <div class="col-sm-2">
                                <input style="width:100%" type="text" placeholder="活动内容" class="form-control"  name="activityContent" th:value="${activityContent}">
                            </div>
                            <div class="col-sm-2">
									<span class="input-group-btn">
										<input style="width:100%" type="submit" value="搜索" class="btn btn-default ">
									</span>
                            </div>
                        </form>

                    </div>


                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>

                        <tr class="text-center">
                            <td>标号</td>
                            <td>活动发起人</td>
                            <td>活动内容</td>
                            <td>开始时间</td>
                            <td>截止时间</td>
                            <td>活动完成者</td>
                            <td>完成者学号</td>
                            <td>状态</td>
                            <td>是否接受</td>
                        </tr>
                        </thead>
                        <tbody>
                        <!--以下代码需修改 -->
                        <tr class="gradeA text-center"  th:each="activity:${pageInfo.list}">
                            <td th:text="${activityStat.index}">标号</td>
                            <td th:text="${activity.activityAuthor}">发起者</td>
                            <td th:text="${activity.activityContent}">活动内容</td>


                            <td th:if="${#dates.format(activity.activityBeginDate,'yyyy-MM-dd')}!=null">
                                <span>[[${#dates.format(activity.activityBeginDate,'yyyy-MM-dd')}]]</span>
                            </td>
                            <td th:unless="${#dates.format(activity.activityBeginDate,'yyyy-MM-dd')}!=null">
                                <span>无</span>
                            </td>

                            <td th:if="${#dates.format(activity.activityEndDate,'yyyy-MM-dd')}!=null">
                                <span>[[${#dates.format(activity.activityEndDate,'yyyy-MM-dd')}]]</span>
                            </td>
                            <td th:unless="${#dates.format(activity.activityEndDate,'yyyy-MM-dd')}!=null">
                                <span>无</span>
                            </td>

                            <td th:text="${activity.activityUser?.userName}">用户</td>
                            <td th:text="${activity.activityUser?.userId}">用户ID</td>

                            <td th:switch="${activity.activityState}">
                                <span th:case="0">未接收</span>
                                <span th:case="1">已接收</span>
                                <span th:case="2">已完成</span>
                            </td>

                            <td>
                                <a  class="btn btn-primary btn-xs" th:if="${activity.activityState}==0"
                                    th:href="@{'/activity/updateActivityState0_1?activityId='+${activity.activityId}}">
                                    接收
                                </a>
                                <a  class="btn btn-primary btn-xs" th:if="${activity.activityState}!=0" disabled="" >
                                    不可接收
                                </a>
                            </td>
                        </tr>
                        <!--以上代码需修改 -->
                        </tbody>
                    </table>
                </div>
            </div>
            <!--显示分页信息-->
            <div class="modal-footer no-margin-top">
                <div class="col-md-6">
                    当前第 [[${pageInfo.pageNum}]]页,共 [[${pageInfo.pages}]] 页.一共 [[${pageInfo.total}]] 条记录
                </div>

                <ul class="pagination pull-right no-margin">
                    <li th:if="${pageInfo.hasPreviousPage}">
                        <a th:href="'/activity/selectAllActivities?pageNum=1'">首页</a>
                    </li>

                    <li class="prev" th:if="${pageInfo.hasPreviousPage}">
                        <a th:href="'/activity/selectAllActivities?pageNum='+${pageInfo.prePage}">
                            <<
                        </a>
                    </li>
                    <!--遍历条数-->
                    <li th:each="nav:${pageInfo.navigatepageNums}">
                        <a th:href="'/activity/selectAllActivities?pageNum='+${nav}" th:text="${nav}" th:if="${nav != pageInfo.pageNum}"></a>
                        <span style="font-weight: bold;background: #6faed9;" th:if="${nav == pageInfo.pageNum}" th:text="${nav}" ></span>
                    </li>

                    <li class="next" th:if="${pageInfo.hasNextPage}">
                        <a th:href="'/activity/selectAllActivities?pageNum='+${pageInfo.nextPage}">
                            >>
                        </a>
                    </li>

                    <li>
                        <a th:href="'/news/selectAllUsers?pageNum='+${pageInfo.pages}">尾页</a>
                    </li>
                </ul>
            </div>

        </div>
    </div>
</div>

<!--表单中没有编写提交方式，默认是get,如果使用的是Rest方式，那么必须加method="post" -->
<form th:action="@{/activity/deleteOneActivity}">
    <input type="hidden" name="activityId"/>
</form>


<!-- 全局js -->
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/plugins/jeditable/jquery.jeditable.js}"></script>

<!-- Data Tables -->
<script th:src="@{/js/plugins/dataTables/jquery.dataTables.js}"></script>
<script th:src="@{/js/plugins/dataTables/dataTables.bootstrap.js}"></script>

<!-- 自定义js -->
<script th:src="@{/js/content.js}"></script>



</body>
</html>